﻿@model Products
@section ToolBar{
    <div class="r-c-tool">
        <a href="javascript:location.reload();" class="l-btn fa fa-refresh"></a>
        <a href="javascript:void(0);" class="l-btn fa fa-search"></a>
    </div>
    <div class="r-c-list">
        @Html.LActionLink("新建商品", "Edit", "Product", new { }, new { @class = "l-btn",single = "single" })
        <a class="l-btn cur"  href="#">全部商品</a>
    </div>
    @*<div class="r-c-search fr">
        <label class="relative fl">
            <input class="inp-text bc1" type="text" /><a href="javascript:void(0)" class="fa fa-search absolute c5"></a>
        </label>
        <a href="javascript:void(0)" class="senior-search fl">高级<br />搜索</a>
    </div>*@
}
<div class="l-m-table">
    <table>
        <tr class="bgc3">
            <th>图片</th>
            <th>商品编号</th>
            <th>商品名称</th>
            <th>单位</th>
            <th>条码</th>
            <th>标准售价</th>
            <th>库存</th>
            <th>锁定库存</th>
            <th>可用库存</th>
            <th>启用状态</th>
            <th>操作</th>
        </tr>
        @if (Model==null || Model.Items.Count <= 0) {
            <tr>
                <td colspan="11" class="t-c c0">暂无记录</td>
            </tr>
        }
        @foreach (Product p in Model.Items)
        {
            <tr>
                <td><img src="@p.Image60" /></td>
                <td>@Html.LActionLink(p.ProductNo, "Detail", "Product", new { id = p.ProductId })</td>
                <td>@Html.LActionLink(p.ProductName, "Detail", "Product", new { id = p.ProductId })</td>
                <td>@p.Unit</td>
                <td>@p.Barcode</td>
                <td>@p.Price.MoneyFormat()</td>
                <td>@p.StoreCount.QuantityFormat()</td>
                <td>@p.LockCount.QuantityFormat()</td>
                <td>@p.UseableCount.QuantityFormat()</td>
                <td>@(p.IsActive?"是":"否")</td>
                <td>
                    @Html.LActionLink("修改", "Edit", "Product", new { id = p.ProductId },new { single="single"})
                    @Html.LAjaxPost("删除", new { id = p.ProductId, url = Url.Action("Delete", "Product"), callback = "callbackRemoveTr", tag = "delete"  })
                    @Html.LAjaxPost(p.IsActive ? "禁用" : "启用", new { id = p.ProductId, isActive = !p.IsActive,url = Url.Action("Active", "Product") })
                    @Html.LActionLink("期初库存", "Index", "StoreInitial", new { id = p.ProductId }, new { single = "single" })
                </td>
            </tr>
        }
    </table>
</div>
@section Pager{
   @Html.Pager("Index", "Product", Model.TotalCount, (int)ViewBag.PageIndex, 20)
}